/*
 * @Author: Eli.Chen
 * @Date: 2025-03-03 15:37:13
 * @LastEditors: Eli.Chen
 * @LastEditTime: 2025-03-03 15:37:49
 * @Description: 用户信息
 */
import axiosRequest from '@/utils/request';

export function getUserPartInfo(userId) {
    return axiosRequest({
        url: `/user/part-info?userId=${userId}`,
        method: 'GET',
    });
}

export function getUserProfile(userId) {
    return axiosRequest({
        url: `/user/profile?userId=${userId}`,
        method: 'GET',
    });
}

export function getUserTPostsList(userId) {
    return axiosRequest({
        url: `/user/t-posts/list?userId=${userId}`,
        method: 'GET',
    });
}

export function deleteTPost(tPostId) {
    return axiosRequest({
        url: `/user/t-post/delete?tPostId=${tPostId}`,
        method: 'PUT',
    });
}

export function getAvatarPath(userId) {
    return axiosRequest({
        url: `/user/avatar/path?userId=${userId}`,
        method: 'GET',
    });
}

export function uploadAvatar(userId, avatar) {
    return axiosRequest({
        url: `/user/avatar/upload?userId=${userId}`,
        method: 'POST',
        data: avatar,
        headers: { 'Content-Type': 'multipart/form-data' },
    });
}

export function updateUserProfile(data) {
    return axiosRequest({
        url: '/user/profile/edit',
        method: 'PUT',
        data: data,
    });
}

export function checkSecurityInfo() {
    return axiosRequest({
        url: '/user/search/security-info',
        method: 'GET',
    });
}

export function updateSecurityEmail(data) {
    return axiosRequest({
        url: '/user/edit/security-email',
        method: 'PUT',
        data: data,
    });
}
